package org.mathcloud.math.core.generic.operator.algebra;

import org.mathcloud.math.core.common.operator.algebra.Arg;
import org.mathcloud.math.core.common.quantity.ComplexNumber;
import org.mathcloud.math.core.generic.operator.GenericUnaryOperator;
import org.mathcloud.math.core.generic.quantity.GenericRealNumber;

public class GenericArg extends GenericUnaryOperator implements Arg
{
	public GenericArg()
	{
		super();
		signature.setMMLContentTag("arg");
	}
	
	
	@Override
	public void calculate()
	{
		if (operand.getSignature().isRealNumberSignature())
			res = new GenericRealNumber(0.0);
		else if (operand.getSignature().isComplexNumberSignature())
			res = new GenericRealNumber(((ComplexNumber)operand).getArg());
	}

}
